<!-- <!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>小猪巴士|企业管理平台</title>
  </head>
  <body>
    <div id="app"></div>
  </body>
</html> -->
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
    <meta name="description" content="NativeShare 是一个整合了各大移动端浏览器调用原生分享的插件！！！">
    <title>NativeShare demo</title>
    <style>
        html,
        body {
            height: 100%;
            display: -webkit-box;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-align: center;
            -ms-flex-align: center;
            align-items: center;
        }

        button {
            padding: 15px;
        }
    </style>
    <script>
        var _hmt = _hmt || [];
        (function () {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?d69321757dcfbfbe09dbddd4dca87b28";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
</head>

<body>
    <div id="app"></div>
    <div>
        <button onclick="call()">通用分享</button>
        <button onclick="call('wechatFriend')">微信好友</button>
        <button onclick="call('wechatTimeline')">朋友圈</button>
        <button onclick="call('qqFriend')">QQ</button>
        <button onclick="call('qZone')">QQ空间</button>
        <button onclick="call('weibo')">微博</button>
        <button onclick="setTitle('fa-ge NativeShare')">设置标题</button>
    </div>
    <script type="text/javascript" src="../NativeShare.js"></script>
    <script>
        var nativeShare = new NativeShare()
        var shareData = {
            title: 'NativeShare',
            desc: 'NativeShare是一个整合了各大移动端浏览器调用原生分享的插件',
            // 如果是微信该link的域名必须要在微信后台配置的安全域名之内的。
            link: 'https://github.com/fa-ge/NativeShare',
            icon: 'https://pic3.zhimg.com/v2-080267af84aa0e97c66d5f12e311c3d6_xl.jpg',
            // 不要过于依赖以下两个回调，很多浏览器是不支持的
            success: function() {
                alert('success')
            },
            fail: function() {
                alert('fail')
            }
        }
        nativeShare.setShareData(shareData)

        function call(command) {
            try {
                nativeShare.call(command)
            } catch (err) {
                // 如果不支持，你可以在这里做降级处理
                alert(err.message)
            }
        }

        function setTitle(title) {
            nativeShare.setShareData({
                title: title,
            })
        }
    </script>
</body>

</html>